package hdfs_pro;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class DeleteDir {
    public static void main(String[] args) {
        try {
            Configuration conf = new Configuration();
            FileSystem fs = FileSystem.get(conf);
            String dirPath = args[0];
        Path hdfsPath = new Path(dirPath);  
        if(fs.delete(hdfsPath,true)){
            System.out.println("Directory "+ dirPath +" has been deleted successfully!");
        }
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
}